package com.emergency.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.emergency.data.entity.SuppliesType;
import com.emergency.data.vo.SuppliesTypeVO;
import com.emergency.mapper.SuppliesTypeMapper;
import com.emergency.service.SuppliesTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * (SuppliesType)物资类型服务实现类
 *
 * @author makejava
 * @since 2020-09-21
 */
@Service
public class SuppliesTypeServiceImpl extends ServiceImpl<SuppliesTypeMapper, SuppliesType> implements SuppliesTypeService {

    @Resource
    private SuppliesTypeMapper suppliesTypeMapper;

    @Override
    public List<SuppliesTypeVO> getSuppliesTypeList() {
        return suppliesTypeMapper.selectList(null).stream().map(c -> {
            SuppliesTypeVO vo = new SuppliesTypeVO();
            BeanUtil.copyProperties(c, vo);
            return vo;
        }).collect(Collectors.toList());
    }
}
